package com.wondedDream.controller.web;

import com.wondedDream.model.CourseCategory;
import com.wondedDream.service.CourseCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController(value = "webCourseCategoryController")
@RequestMapping("/web/courseCategories")
@Api(description = "客户端-用户分类模块")
public class UserCourseCategoryController {

    @Autowired
    private CourseCategoryService courseCategoryService;

    // 获取课程分类信息
    @GetMapping("/{id}")
    @ApiOperation(value = "根据分类id获取")
    public CourseCategory getCourseCategoryById(@PathVariable Integer id) {
        return courseCategoryService.getCourseCategoryById(id);
    }

    // 获取所有课程分类信息
    @GetMapping("/")
    @ApiOperation(value = "获取所有课程分类信息")
    public List<CourseCategory> getAllCourseCategories() {
        return courseCategoryService.getAllCourseCategories();
    }
}